import request from '@/router/axios'
import {
  fenExYuangettoFixed,fenExYuangettoFixed7
} from "../../subwayRat/commonCheck";
import Vue from 'vue';
import store from '@/store';



export let allStatus=JSON.parse(localStorage.getItem("allStatus")?localStorage.getItem("allStatus"):"{}");

/**
 * 查询列表
 * @param query
 */
export function getTransferDiffList(query){
  return request({
    url: '/check/cleardiff/getTransferDiffList',
    method: 'get',
    params: query
  });
}
export function getExcelList(query){
  return request({
    url: '/check/cleardiff/getTransferDiffList',
    method: 'get',
    params: query
  });
}
export function saveDiffBatch(param){
  return request({
    url: '/check/cleardiff/saveDiffBatch',
    method: 'post',
    data: param,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
  })
}
/**
 * 导入
 * @param body
 */
 export function saveDiffBatchList(body) {
  return request({
    url: "/check/cleardiff/saveDiffBatchList",
    headers: { "Content-Type": "multipart/form-data" },
    method: "post",
    data: body
  });
}
//导出
export function dataExport(query) {
  return request({
    url: '/check/cleardiff/export',
    method: 'get',
    responseType: 'blob',
    params: query
  })
}
export function saveMutilCleardDiff(query){
  return request({
    url: '/check/cleardiff/saveMutilCleardDiff',
    method: 'post',
    data: query,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
  });
}
export function sendMutilCleardDiff(query){
  return request({
    url: '/check/cleardiff/sendMutilCleardDiff',
    method: 'post',
    data: query,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
  });
}
/**
 * 清空搜索条件的值
 */
export function setSearchFiledsEmpty(form){
  for(let key in form){
    if(key.indexOf("$")==0){
      return;
    }
    form[key]='';
  }
}

export const tableOption = {
  searchMenuSpan:5,
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  menu:false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  selection: true,
  reserveSelection:false,
  addBtn: false,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  },{
    hide: false,
    label: '报表名称',
    prop: 'diffSource',
    type: 'select',
    search: true,
    searchslot : true,
    width:200,
    // searchRules: [{
    //   required: true,
    //   message: "请选择报表名称",
    //   trigger: "blur"
    // }],
    dicData:[{label:'单程票-应收-实收统计 ',value:1},{label:'二维码应收-应付差异统计',value:2},{label:'人脸电子票应收应付差异统计',value:3}],
    formatter:function(row, value , label, column){
      return value == 1?'单程票-应收-实收统计': (value == 2?'二维码应收-应付差异统计':(value == 3?'人脸电子票应收应付差异统计':'未知'));
    },
    slot:true,
    display: true // 动态显隐控制不能删除
  },   {
    hide: false,
    width:'150px',
    label: '单程票清分日期',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    prop: 'rediffTradeDate',
    type:'datetime',
  },   {
    hide: false,
    width:'150px',
    label: '二维码清分日期',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    prop: 'qrdiffTradeDate',
    type:'datetime',
  },   {
    hide: false,
    width:'150px',
    label: '人脸清分日期',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    prop: 'acdiffTradeDate',
    type:'datetime',
  },  {
    hide: false,
    width:'150px',
    label: '差异回复日期',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    searchLabelWidth: 120,
    prop: 'diffReasonTime',
    type:'datetime',
    search:true,
    searchslot : true,
  },{
    label: '实收',
    width:'150px',
    prop: 'alrealIncomeMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'alrealIncomeMoney');
    },
  },{
    label: 'ACC应收（预制单程票+单程票+互联网)',
    width:'300px',
    prop: 'reaccReceivableMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'reaccReceivableMoney');
    },
  },{
    label: 'ACC应付（清分结果）',
    width:'150px',
    prop: 'reaccPayableMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'reaccPayableMoney');
    },
  },{
    label: '差异（实收-ACC应收)',
    width:'150px',
    prop: 'rediffAccRealMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'rediffAccRealMoney');
    },
  },{
    label: '差异（ACC应收-ACC应付）',
    width:'180px',
    prop: 'rediffAccReceivableMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'rediffAccReceivableMoney');
    },
  },{
    label: 'ACC清分金额',
    width:'150px',
    prop: 'alaccMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'alaccMoney');
    },
  },{
    label: '差异（实收金额-ACC清分金额）',
    width:'200px',
    prop: 'aldiffAccMoney',
    hide: false,
    search: false,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed7(row,'aldiffAccMoney');
    },
  },{
    label: '通知时间',
    width:'150px',
    prop: 'createTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    type:'date',
    hide: false,
    search: false
  },{
    label: '回复期限（天）',
    width:'150px',
    prop: 'replayLimit',
    hide: false,
    search: false
  },{
    label: '是否期限内回复',
    width:'150px',
    prop: 'isInTime',
    dicData:[{label:'是',value:1},{label:'否',value:0}],
    formatter:function(row, value , label, column){
      return value == 1?'是':'否';
    },
    hide: false,
    search: false
  },{
  label: '差异原因',
  width:'150px',
  prop: 'diffReason',
    hide: false,
    search: false
  },{
    hide: false,
    label: '下发状态',
    width:'150px',
    prop: 'sendStatus',
    type: 'select',
    search: true,
    searchslot : true,
    dicData:[{label:'已下发',value:1},{label:'未下发',value:0}],
    formatter:function(row, value , label, column){
      return value == 1?'已下发':'未下发';
    },
    display: true// 动态显隐控制不能删除
  }]
}


